package com.x.client.adapter

import android.support.v4.content.ContextCompat
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.x.client.R
import com.x.client.bean.PriceItem
import com.x.client.fragment.BuyCarFragment
import com.x.client.utils.RouterField.data

/**
 * Creator : GG
 * Date    : 2018/6/15
 * Mail    : gg.jin.yu@gmai.com
 * Explain :
 */
class PriceAdapter(data: List<PriceItem> = listOf()) : BaseQuickAdapter<PriceItem, BaseViewHolder>(R.layout.item_price, data) {
    override fun convert(helper: BaseViewHolder, item: PriceItem) {
        helper.setText(R.id.text, item.name)
        if (item.status) {
            helper.setTextColor(R.id.text, ContextCompat.getColor(mContext, R.color.white))
                    .setBackgroundRes(R.id.text, R.drawable.distribution_bg_onpress)
        } else {
            helper.setTextColor(R.id.text, ContextCompat.getColor(mContext, R.color.black))
                    .setBackgroundRes(R.id.text, R.drawable.distribution_bg_unpress)
        }
    }
}